<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML ">
<html>
<head>
<title>'novelinfo.jsp'</title>
<style type="text/css">
#smy {
	border-style: none;
	height: 100px;
	width: 200px;
	overflow-y: visible;
	overflow-x: visible;
	resize: none;
}

#sph, #toModify{
	display: none;
}
a{
text-decoration:none;
}
</style>
<script type="text/javascript">
	function chacterpage(cid) {
		var url = "${pageContext.request.contextPath }/ChacterPage";
		var method = "POST";
		var params = "cid=" + cid;
		var target = "target";
		toDoXHR(url, method, params, target);
	}
	function modifyChacter(num, nid) {
		var sure = confirm("确认修改吗？");
		if (sure) {
			var title = document.getElementById("title").value;
			var content = document.getElementById("content").innerHTML;
			var url = "${pageContext.request.contextPath }/author/SaveAChacter";
			var method = "POST";
			var params = "num=" + num + "&nid=" + nid + "&title=" + title
					+ "&content=" + content + "&modify=modify";
			var tag2 = "sph";
			toDoXHR(url, method, params, tag2);
		}

	}
	function changeModify() {
		document.all.content.contentEditable = true;
		document.getElementById("sph").style.display = "inline";
		document.getElementById("toModify").style.display = "inline";
	}
</script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/JS/toDoXHR.js"></script>
</head>

<body>
	<div align="center">
		<h2 align="center">${tips }</h2>
		<c:if test="${not empty novel }">
			<input type="hidden" name="novelid" value="${novel.id }" />

			<table>
				<tr>
					<td>小说名称：</td>
					<td>${novel.name }</td>
				</tr>
				<tr>
					<td>作者：</td>
					<td>${novel.author_nickname }</td>
				</tr>

				<tr>
					<c:if test="${novel.author_nickname eq whologin.nickname }">
						<td><a
							href="${pageContext.request.contextPath }/AuthorUIServlet">编辑</a>
						</td>
					</c:if>
					<c:if test="${whologin.status==0  }">
						<td><a
							href="${pageContext.request.contextPath }/reader/ToMyFavorServlet?uid=${whologin.id}&nid=${novel.id}">
								收藏</a></td>
					</c:if>
				</tr>
				<tr>
					<td colspan="2">简介</td>

				</tr>
				<tr>
					<td colspan="2"><textarea id="smy" readonly="readonly"> ${novel.summary }</textarea>
					</td>
				</tr>
			</table>
		</c:if>
	</div>
	<div align="center">
		<!-- 小说的所有章节 -->
		<table>
			<tr>
				<c:forEach var="chacter" items="${chacters }" varStatus="status">
					<td><a href="#" onclick="chacterpage('${chacter.id}')">
							第${chacter.num}章&nbsp;${chacter.title }&nbsp;&nbsp; </a></td>
					<c:if test="${status.count%5==0 }">
			</tr>
			<tr>
				</c:if>
				</c:forEach>
			</tr>
		</table>
	</div>
	<div id="target"></div>
</body>
</html>
